//
//  TestProblem215.swift
//  LeetCodeTests
//
//  Created by 武侠 on 2023/6/27.
//  Copyright © 2023 zhulongiMac02. All rights reserved.
//

import XCTest
@testable import LeetCode

final class TestProblem215: XCTestCase {

    var problem = Problem215()
    
    override func setUp() {
        super.setUp()
        // Put setup code here. This method is called before the invocation of each test method in the class.
    }
    
    override func tearDown() {
        // Put teardown code here. This method is called after the invocation of each test method in the class.
        super.tearDown()
    }
    
    // MARK: - 排序
    func testProblem215_Case1() throws {
        let nums = [3,2,1,5,6,4]
        XCTAssertEqual(problem.findKthLargest(nums, 2), 5)
    }
    
    func testProblem215_Case2() throws {
        let nums = [3,2,3,1,2,4,5,5,6]
        XCTAssertEqual(problem.findKthLargest(nums, 4), 4) 
    }
    
    func testProblem215_Case3() throws {
        let nums = [3,2]
        XCTAssertEqual(problem.findKthLargest(nums, 1), 3)
    }
    
    func testProblem215_Case4() throws {
        let nums = [3,2,1,3,3,3,3,5,6,4]
        XCTAssertEqual(problem.findKthLargest(nums, 9), 2)
    }
}
